<template>
  <div class="content-area">
    <h2>角色管理</h2>
    <div class="content">
      <el-table :data="roleList" style="width: 100%">
        <el-table-column prop="id" label="ID" width="80" />
        <el-table-column prop="name" label="角色名称" width="150" />
        <el-table-column prop="description" label="描述" width="300" />
        <el-table-column prop="permissions" label="权限数量" width="100" />
        <el-table-column prop="status" label="状态" width="100">
          <template #default="scope">
            <el-tag :type="scope.row.status === '启用' ? 'success' : 'danger'">
              {{ scope.row.status }}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column label="操作" width="200">
          <template #default="scope">
            <el-button size="small" @click="handleEdit(scope.row)">编辑</el-button>
            <el-button size="small" type="danger" @click="handleDelete(scope.row)">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
export default {
  name: 'RoleManagement',
  data() {
    return {
      roleList: [
        { id: 1, name: '超级管理员', description: '拥有所有权限', permissions: 50, status: '启用' },
        { id: 2, name: '普通管理员', description: '拥有部分管理权限', permissions: 30, status: '启用' },
        { id: 3, name: '普通用户', description: '基础操作权限', permissions: 10, status: '启用' }
      ]
    }
  },
  methods: {
    handleEdit(row) {
      console.log('编辑角色:', row)
    },
    handleDelete(row) {
      console.log('删除角色:', row)
    }
  }
}
</script>

<style scoped>
.content-area {
  background: white;
  border-radius: 8px;
  padding: 30px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  min-height: 400px;
}

.content-area h2 {
  color: #303133;
  margin-bottom: 20px;
  border-bottom: 2px solid #409eff;
  padding-bottom: 10px;
}

.content {
  color: #606266;
  line-height: 1.8;
  font-size: 16px;
}
</style> 